{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Numenta Anomaly Benchmark"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import json\n",
    "import os\n",
    "from typing import Final\n",
    "from collections.abc import Callable\n",
    "from datetime import datetime\n",
    "from config import data_raw_folder, data_processed_folder\n",
    "from timeeval import Datasets"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Looking for source datasets in /home/projects/akita/data/benchmark-data/data-raw/Community-NAB and\n",
      "saving processed datasets in /home/projects/akita/data/benchmark-data/data-processed\n"
     ]
    }
   ],
   "source": [
    "dataset_collection_name = \"NAB\"\n",
    "source_folder = os.path.join(data_raw_folder, \"Community-NAB\")\n",
    "target_folder = data_processed_folder\n",
    "\n",
    "from pathlib import Path\n",
    "print(f\"Looking for source datasets in {Path(source_folder).absolute()} and\\nsaving processed datasets in {Path(target_folder).absolute()}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "def calc_size(filename: str) -> int:\n",
    "    with open(filename, 'r') as f:\n",
    "        next(f) # skips header\n",
    "        c = 0\n",
    "        for line in f:\n",
    "            c += 1\n",
    "    return c\n",
    "\n",
    "def transform_and_label(source: str, target: str, anomaly_windows: list[str]) -> None:\n",
    "    df = pd.read_csv(source)\n",
    "    df[\"timestamp\"] = pd.to_datetime(df['timestamp'], infer_datetime_format=True)\n",
    "    df[\"is_anomaly\"] = 0\n",
    "\n",
    "    for t1, t2 in anomaly_windows:\n",
    "        t1 = datetime.strptime(t1, \"%Y-%m-%d %H:%M:%S.%f\")\n",
    "        t2 = datetime.strptime(t2, \"%Y-%m-%d %H:%M:%S.%f\")\n",
    "        moreThanT1 = df[df[\"timestamp\"] >= t1]\n",
    "        betweenT1AndT2 = moreThanT1[moreThanT1[\"timestamp\"] <= t2]\n",
    "        indices = betweenT1AndT2.index\n",
    "        df[\"is_anomaly\"].values[indices.values] = 1\n",
    "\n",
    "    df.to_csv(target, index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Directories /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB already exist\n"
     ]
    }
   ],
   "source": [
    "# shared by all datasets\n",
    "input_type = \"univariate\"\n",
    "datetime_index = True\n",
    "train_type = \"unsupervised\"\n",
    "train_is_normal = False\n",
    "\n",
    "# create target directory\n",
    "dataset_subfolder = os.path.join(input_type, dataset_collection_name)\n",
    "target_subfolder = os.path.join(target_folder, dataset_subfolder)\n",
    "try:\n",
    "    os.makedirs(target_subfolder)\n",
    "    print(f\"Created directories {target_subfolder}\")\n",
    "except FileExistsError:\n",
    "    print(f\"Directories {target_subfolder} already exist\")\n",
    "    pass\n",
    "\n",
    "dm = Datasets(target_folder)\n",
    "\n",
    "with open(os.path.join(source_folder, \"labels\", \"combined_windows.json\"), 'r') as f:\n",
    "    windows = json.load(f)\n",
    "\n",
    "#windows"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/artificialNoAnomaly/art_daily_no_noise.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/art_daily_no_noise.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/artificialNoAnomaly/art_daily_perfect_square_wave.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/art_daily_perfect_square_wave.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/artificialNoAnomaly/art_daily_small_noise.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/art_daily_small_noise.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/artificialNoAnomaly/art_flatline.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/art_flatline.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/artificialNoAnomaly/art_noisy.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/art_noisy.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/artificialWithAnomaly/art_daily_flatmiddle.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/art_daily_flatmiddle.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/artificialWithAnomaly/art_daily_jumpsdown.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/art_daily_jumpsdown.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/artificialWithAnomaly/art_daily_jumpsup.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/art_daily_jumpsup.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/artificialWithAnomaly/art_daily_nojump.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/art_daily_nojump.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/artificialWithAnomaly/art_increase_spike_density.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/art_increase_spike_density.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/artificialWithAnomaly/art_load_balancer_spikes.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/art_load_balancer_spikes.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/ec2_cpu_utilization_24ae8d.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/ec2_cpu_utilization_24ae8d.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/ec2_cpu_utilization_53ea38.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/ec2_cpu_utilization_53ea38.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/ec2_cpu_utilization_5f5533.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/ec2_cpu_utilization_5f5533.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/ec2_cpu_utilization_77c1ca.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/ec2_cpu_utilization_77c1ca.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/ec2_cpu_utilization_825cc2.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/ec2_cpu_utilization_825cc2.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/ec2_cpu_utilization_ac20cd.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/ec2_cpu_utilization_ac20cd.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/ec2_cpu_utilization_c6585a.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/ec2_cpu_utilization_c6585a.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/ec2_cpu_utilization_fe7f93.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/ec2_cpu_utilization_fe7f93.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/ec2_disk_write_bytes_1ef3de.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/ec2_disk_write_bytes_1ef3de.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/ec2_disk_write_bytes_c0d644.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/ec2_disk_write_bytes_c0d644.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/ec2_network_in_257a54.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/ec2_network_in_257a54.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/ec2_network_in_5abac7.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/ec2_network_in_5abac7.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/elb_request_count_8c0756.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/elb_request_count_8c0756.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/grok_asg_anomaly.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/grok_asg_anomaly.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/iio_us-east-1_i-a2eb1cd9_NetworkIn.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/iio_us-east-1_i-a2eb1cd9_NetworkIn.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/rds_cpu_utilization_cc0c53.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/rds_cpu_utilization_cc0c53.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAWSCloudwatch/rds_cpu_utilization_e47b3b.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/rds_cpu_utilization_e47b3b.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAdExchange/exchange-2_cpc_results.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/exchange-2_cpc_results.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAdExchange/exchange-2_cpm_results.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/exchange-2_cpm_results.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAdExchange/exchange-3_cpc_results.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/exchange-3_cpc_results.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAdExchange/exchange-3_cpm_results.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/exchange-3_cpm_results.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAdExchange/exchange-4_cpc_results.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/exchange-4_cpc_results.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realAdExchange/exchange-4_cpm_results.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/exchange-4_cpm_results.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realKnownCause/ambient_temperature_system_failure.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/ambient_temperature_system_failure.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realKnownCause/cpu_utilization_asg_misconfiguration.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/cpu_utilization_asg_misconfiguration.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realKnownCause/ec2_request_latency_system_failure.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/ec2_request_latency_system_failure.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realKnownCause/machine_temperature_system_failure.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/machine_temperature_system_failure.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realKnownCause/nyc_taxi.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/nyc_taxi.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realKnownCause/rogue_agent_key_hold.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/rogue_agent_key_hold.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realKnownCause/rogue_agent_key_updown.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/rogue_agent_key_updown.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTraffic/TravelTime_387.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/TravelTime_387.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTraffic/TravelTime_451.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/TravelTime_451.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTraffic/occupancy_6005.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/occupancy_6005.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTraffic/occupancy_t4013.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/occupancy_t4013.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTraffic/speed_6005.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/speed_6005.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTraffic/speed_7578.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/speed_7578.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTraffic/speed_t4013.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/speed_t4013.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTweets/Twitter_volume_AAPL.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/Twitter_volume_AAPL.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTweets/Twitter_volume_AMZN.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/Twitter_volume_AMZN.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTweets/Twitter_volume_CRM.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/Twitter_volume_CRM.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTweets/Twitter_volume_CVS.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/Twitter_volume_CVS.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTweets/Twitter_volume_FB.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/Twitter_volume_FB.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTweets/Twitter_volume_GOOG.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/Twitter_volume_GOOG.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTweets/Twitter_volume_IBM.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/Twitter_volume_IBM.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTweets/Twitter_volume_KO.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/Twitter_volume_KO.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTweets/Twitter_volume_PFE.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/Twitter_volume_PFE.test.csv\n",
      "Processed source dataset /home/projects/akita/data/benchmark-data/data-raw/Community-NAB/data/realTweets/Twitter_volume_UPS.csv -> /home/projects/akita/data/benchmark-data/data-processed/univariate/NAB/Twitter_volume_UPS.test.csv\n"
     ]
    }
   ],
   "source": [
    "# dataset transformation\n",
    "transform_file: Callable[[str, str, list[str]], None] = transform_and_label\n",
    "\n",
    "for dataset in windows:\n",
    "    source_file = os.path.join(source_folder, \"data\", dataset)\n",
    "    dataset_type = \"real\" if dataset.startswith(\"real\") else \"synthetic\"\n",
    "    \n",
    "    # get basename for target filename\n",
    "    basename = os.path.splitext(os.path.basename(source_file))[0]\n",
    "    filename = f\"{basename}.test.csv\"\n",
    "\n",
    "    # save metadata\n",
    "    dataset_name = filename.split(\".\")[0]\n",
    "    path = os.path.join(dataset_subfolder, filename)\n",
    "    target_filepath = os.path.join(target_subfolder, filename)\n",
    "    dataset_length = calc_size(source_file)\n",
    "    dm.add_dataset((dataset_collection_name, dataset_name),\n",
    "        train_path = None,\n",
    "        test_path = path,\n",
    "        dataset_type = dataset_type,\n",
    "        datetime_index = datetime_index,\n",
    "        split_at = None,\n",
    "        train_type = train_type,\n",
    "        train_is_normal = train_is_normal,\n",
    "        input_type = input_type,\n",
    "        dataset_length = dataset_length\n",
    "    )\n",
    "    # transform file\n",
    "    transform_file(source_file, target_filepath, windows[dataset])\n",
    "    print(f\"Processed source dataset {source_file} -> {target_filepath}\")\n",
    "\n",
    "# save metadata of benchmark\n",
    "dm.save()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>train_path</th>\n",
       "      <th>test_path</th>\n",
       "      <th>dataset_type</th>\n",
       "      <th>datetime_index</th>\n",
       "      <th>split_at</th>\n",
       "      <th>train_type</th>\n",
       "      <th>train_is_normal</th>\n",
       "      <th>input_type</th>\n",
       "      <th>length</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>collection_name</th>\n",
       "      <th>dataset_name</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"58\" valign=\"top\">NAB</th>\n",
       "      <th>TravelTime_387</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/TravelTime_387.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>2500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>TravelTime_451</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/TravelTime_451.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>2162</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Twitter_volume_AAPL</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/Twitter_volume_AAPL.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>15902</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Twitter_volume_AMZN</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/Twitter_volume_AMZN.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>15831</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Twitter_volume_CRM</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/Twitter_volume_CRM.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>15902</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Twitter_volume_CVS</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/Twitter_volume_CVS.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>15853</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Twitter_volume_FB</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/Twitter_volume_FB.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>15833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Twitter_volume_GOOG</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/Twitter_volume_GOOG.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>15842</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Twitter_volume_IBM</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/Twitter_volume_IBM.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>15893</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Twitter_volume_KO</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/Twitter_volume_KO.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>15851</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Twitter_volume_PFE</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/Twitter_volume_PFE.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>15858</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Twitter_volume_UPS</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/Twitter_volume_UPS.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>15866</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ambient_temperature_system_failure</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/ambient_temperature_system_fail...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>7267</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>art_daily_flatmiddle</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/art_daily_flatmiddle.test.csv</td>\n",
       "      <td>synthetic</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>art_daily_jumpsdown</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/art_daily_jumpsdown.test.csv</td>\n",
       "      <td>synthetic</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>art_daily_jumpsup</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/art_daily_jumpsup.test.csv</td>\n",
       "      <td>synthetic</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>art_daily_no_noise</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/art_daily_no_noise.test.csv</td>\n",
       "      <td>synthetic</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>art_daily_nojump</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/art_daily_nojump.test.csv</td>\n",
       "      <td>synthetic</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>art_daily_perfect_square_wave</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/art_daily_perfect_square_wave.t...</td>\n",
       "      <td>synthetic</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>art_daily_small_noise</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/art_daily_small_noise.test.csv</td>\n",
       "      <td>synthetic</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>art_flatline</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/art_flatline.test.csv</td>\n",
       "      <td>synthetic</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>art_increase_spike_density</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/art_increase_spike_density.test...</td>\n",
       "      <td>synthetic</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>art_load_balancer_spikes</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/art_load_balancer_spikes.test.csv</td>\n",
       "      <td>synthetic</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>art_noisy</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/art_noisy.test.csv</td>\n",
       "      <td>synthetic</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>cpu_utilization_asg_misconfiguration</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/cpu_utilization_asg_misconfigur...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>18050</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ec2_cpu_utilization_24ae8d</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/ec2_cpu_utilization_24ae8d.test...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ec2_cpu_utilization_53ea38</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/ec2_cpu_utilization_53ea38.test...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ec2_cpu_utilization_5f5533</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/ec2_cpu_utilization_5f5533.test...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ec2_cpu_utilization_77c1ca</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/ec2_cpu_utilization_77c1ca.test...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ec2_cpu_utilization_825cc2</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/ec2_cpu_utilization_825cc2.test...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ec2_cpu_utilization_ac20cd</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/ec2_cpu_utilization_ac20cd.test...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ec2_cpu_utilization_c6585a</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/ec2_cpu_utilization_c6585a.test...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ec2_cpu_utilization_fe7f93</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/ec2_cpu_utilization_fe7f93.test...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ec2_disk_write_bytes_1ef3de</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/ec2_disk_write_bytes_1ef3de.tes...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4730</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ec2_disk_write_bytes_c0d644</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/ec2_disk_write_bytes_c0d644.tes...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ec2_network_in_257a54</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/ec2_network_in_257a54.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ec2_network_in_5abac7</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/ec2_network_in_5abac7.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4730</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ec2_request_latency_system_failure</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/ec2_request_latency_system_fail...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>elb_request_count_8c0756</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/elb_request_count_8c0756.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>exchange-2_cpc_results</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/exchange-2_cpc_results.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>1624</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>exchange-2_cpm_results</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/exchange-2_cpm_results.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>1624</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>exchange-3_cpc_results</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/exchange-3_cpc_results.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>1538</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>exchange-3_cpm_results</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/exchange-3_cpm_results.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>1538</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>exchange-4_cpc_results</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/exchange-4_cpc_results.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>1643</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>exchange-4_cpm_results</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/exchange-4_cpm_results.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>1643</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>grok_asg_anomaly</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/grok_asg_anomaly.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4621</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>iio_us-east-1_i-a2eb1cd9_NetworkIn</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/iio_us-east-1_i-a2eb1cd9_Networ...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>1243</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>machine_temperature_system_failure</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/machine_temperature_system_fail...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>22695</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>nyc_taxi</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/nyc_taxi.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>10320</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>occupancy_6005</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/occupancy_6005.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>2380</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>occupancy_t4013</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/occupancy_t4013.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>2500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rds_cpu_utilization_cc0c53</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/rds_cpu_utilization_cc0c53.test...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rds_cpu_utilization_e47b3b</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/rds_cpu_utilization_e47b3b.test...</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>4032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rogue_agent_key_hold</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/rogue_agent_key_hold.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>1882</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rogue_agent_key_updown</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/rogue_agent_key_updown.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>5315</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>speed_6005</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/speed_6005.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>2500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>speed_7578</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/speed_7578.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>1127</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>speed_t4013</th>\n",
       "      <td>NaN</td>\n",
       "      <td>univariate/NAB/speed_t4013.test.csv</td>\n",
       "      <td>real</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>unsupervised</td>\n",
       "      <td>False</td>\n",
       "      <td>univariate</td>\n",
       "      <td>2495</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                     train_path  \\\n",
       "collection_name dataset_name                                      \n",
       "NAB             TravelTime_387                              NaN   \n",
       "                TravelTime_451                              NaN   \n",
       "                Twitter_volume_AAPL                         NaN   \n",
       "                Twitter_volume_AMZN                         NaN   \n",
       "                Twitter_volume_CRM                          NaN   \n",
       "                Twitter_volume_CVS                          NaN   \n",
       "                Twitter_volume_FB                           NaN   \n",
       "                Twitter_volume_GOOG                         NaN   \n",
       "                Twitter_volume_IBM                          NaN   \n",
       "                Twitter_volume_KO                           NaN   \n",
       "                Twitter_volume_PFE                          NaN   \n",
       "                Twitter_volume_UPS                          NaN   \n",
       "                ambient_temperature_system_failure          NaN   \n",
       "                art_daily_flatmiddle                        NaN   \n",
       "                art_daily_jumpsdown                         NaN   \n",
       "                art_daily_jumpsup                           NaN   \n",
       "                art_daily_no_noise                          NaN   \n",
       "                art_daily_nojump                            NaN   \n",
       "                art_daily_perfect_square_wave               NaN   \n",
       "                art_daily_small_noise                       NaN   \n",
       "                art_flatline                                NaN   \n",
       "                art_increase_spike_density                  NaN   \n",
       "                art_load_balancer_spikes                    NaN   \n",
       "                art_noisy                                   NaN   \n",
       "                cpu_utilization_asg_misconfiguration        NaN   \n",
       "                ec2_cpu_utilization_24ae8d                  NaN   \n",
       "                ec2_cpu_utilization_53ea38                  NaN   \n",
       "                ec2_cpu_utilization_5f5533                  NaN   \n",
       "                ec2_cpu_utilization_77c1ca                  NaN   \n",
       "                ec2_cpu_utilization_825cc2                  NaN   \n",
       "                ec2_cpu_utilization_ac20cd                  NaN   \n",
       "                ec2_cpu_utilization_c6585a                  NaN   \n",
       "                ec2_cpu_utilization_fe7f93                  NaN   \n",
       "                ec2_disk_write_bytes_1ef3de                 NaN   \n",
       "                ec2_disk_write_bytes_c0d644                 NaN   \n",
       "                ec2_network_in_257a54                       NaN   \n",
       "                ec2_network_in_5abac7                       NaN   \n",
       "                ec2_request_latency_system_failure          NaN   \n",
       "                elb_request_count_8c0756                    NaN   \n",
       "                exchange-2_cpc_results                      NaN   \n",
       "                exchange-2_cpm_results                      NaN   \n",
       "                exchange-3_cpc_results                      NaN   \n",
       "                exchange-3_cpm_results                      NaN   \n",
       "                exchange-4_cpc_results                      NaN   \n",
       "                exchange-4_cpm_results                      NaN   \n",
       "                grok_asg_anomaly                            NaN   \n",
       "                iio_us-east-1_i-a2eb1cd9_NetworkIn          NaN   \n",
       "                machine_temperature_system_failure          NaN   \n",
       "                nyc_taxi                                    NaN   \n",
       "                occupancy_6005                              NaN   \n",
       "                occupancy_t4013                             NaN   \n",
       "                rds_cpu_utilization_cc0c53                  NaN   \n",
       "                rds_cpu_utilization_e47b3b                  NaN   \n",
       "                rogue_agent_key_hold                        NaN   \n",
       "                rogue_agent_key_updown                      NaN   \n",
       "                speed_6005                                  NaN   \n",
       "                speed_7578                                  NaN   \n",
       "                speed_t4013                                 NaN   \n",
       "\n",
       "                                                                                              test_path  \\\n",
       "collection_name dataset_name                                                                              \n",
       "NAB             TravelTime_387                                   univariate/NAB/TravelTime_387.test.csv   \n",
       "                TravelTime_451                                   univariate/NAB/TravelTime_451.test.csv   \n",
       "                Twitter_volume_AAPL                         univariate/NAB/Twitter_volume_AAPL.test.csv   \n",
       "                Twitter_volume_AMZN                         univariate/NAB/Twitter_volume_AMZN.test.csv   \n",
       "                Twitter_volume_CRM                           univariate/NAB/Twitter_volume_CRM.test.csv   \n",
       "                Twitter_volume_CVS                           univariate/NAB/Twitter_volume_CVS.test.csv   \n",
       "                Twitter_volume_FB                             univariate/NAB/Twitter_volume_FB.test.csv   \n",
       "                Twitter_volume_GOOG                         univariate/NAB/Twitter_volume_GOOG.test.csv   \n",
       "                Twitter_volume_IBM                           univariate/NAB/Twitter_volume_IBM.test.csv   \n",
       "                Twitter_volume_KO                             univariate/NAB/Twitter_volume_KO.test.csv   \n",
       "                Twitter_volume_PFE                           univariate/NAB/Twitter_volume_PFE.test.csv   \n",
       "                Twitter_volume_UPS                           univariate/NAB/Twitter_volume_UPS.test.csv   \n",
       "                ambient_temperature_system_failure    univariate/NAB/ambient_temperature_system_fail...   \n",
       "                art_daily_flatmiddle                       univariate/NAB/art_daily_flatmiddle.test.csv   \n",
       "                art_daily_jumpsdown                         univariate/NAB/art_daily_jumpsdown.test.csv   \n",
       "                art_daily_jumpsup                             univariate/NAB/art_daily_jumpsup.test.csv   \n",
       "                art_daily_no_noise                           univariate/NAB/art_daily_no_noise.test.csv   \n",
       "                art_daily_nojump                               univariate/NAB/art_daily_nojump.test.csv   \n",
       "                art_daily_perfect_square_wave         univariate/NAB/art_daily_perfect_square_wave.t...   \n",
       "                art_daily_small_noise                     univariate/NAB/art_daily_small_noise.test.csv   \n",
       "                art_flatline                                       univariate/NAB/art_flatline.test.csv   \n",
       "                art_increase_spike_density            univariate/NAB/art_increase_spike_density.test...   \n",
       "                art_load_balancer_spikes               univariate/NAB/art_load_balancer_spikes.test.csv   \n",
       "                art_noisy                                             univariate/NAB/art_noisy.test.csv   \n",
       "                cpu_utilization_asg_misconfiguration  univariate/NAB/cpu_utilization_asg_misconfigur...   \n",
       "                ec2_cpu_utilization_24ae8d            univariate/NAB/ec2_cpu_utilization_24ae8d.test...   \n",
       "                ec2_cpu_utilization_53ea38            univariate/NAB/ec2_cpu_utilization_53ea38.test...   \n",
       "                ec2_cpu_utilization_5f5533            univariate/NAB/ec2_cpu_utilization_5f5533.test...   \n",
       "                ec2_cpu_utilization_77c1ca            univariate/NAB/ec2_cpu_utilization_77c1ca.test...   \n",
       "                ec2_cpu_utilization_825cc2            univariate/NAB/ec2_cpu_utilization_825cc2.test...   \n",
       "                ec2_cpu_utilization_ac20cd            univariate/NAB/ec2_cpu_utilization_ac20cd.test...   \n",
       "                ec2_cpu_utilization_c6585a            univariate/NAB/ec2_cpu_utilization_c6585a.test...   \n",
       "                ec2_cpu_utilization_fe7f93            univariate/NAB/ec2_cpu_utilization_fe7f93.test...   \n",
       "                ec2_disk_write_bytes_1ef3de           univariate/NAB/ec2_disk_write_bytes_1ef3de.tes...   \n",
       "                ec2_disk_write_bytes_c0d644           univariate/NAB/ec2_disk_write_bytes_c0d644.tes...   \n",
       "                ec2_network_in_257a54                     univariate/NAB/ec2_network_in_257a54.test.csv   \n",
       "                ec2_network_in_5abac7                     univariate/NAB/ec2_network_in_5abac7.test.csv   \n",
       "                ec2_request_latency_system_failure    univariate/NAB/ec2_request_latency_system_fail...   \n",
       "                elb_request_count_8c0756               univariate/NAB/elb_request_count_8c0756.test.csv   \n",
       "                exchange-2_cpc_results                   univariate/NAB/exchange-2_cpc_results.test.csv   \n",
       "                exchange-2_cpm_results                   univariate/NAB/exchange-2_cpm_results.test.csv   \n",
       "                exchange-3_cpc_results                   univariate/NAB/exchange-3_cpc_results.test.csv   \n",
       "                exchange-3_cpm_results                   univariate/NAB/exchange-3_cpm_results.test.csv   \n",
       "                exchange-4_cpc_results                   univariate/NAB/exchange-4_cpc_results.test.csv   \n",
       "                exchange-4_cpm_results                   univariate/NAB/exchange-4_cpm_results.test.csv   \n",
       "                grok_asg_anomaly                               univariate/NAB/grok_asg_anomaly.test.csv   \n",
       "                iio_us-east-1_i-a2eb1cd9_NetworkIn    univariate/NAB/iio_us-east-1_i-a2eb1cd9_Networ...   \n",
       "                machine_temperature_system_failure    univariate/NAB/machine_temperature_system_fail...   \n",
       "                nyc_taxi                                               univariate/NAB/nyc_taxi.test.csv   \n",
       "                occupancy_6005                                   univariate/NAB/occupancy_6005.test.csv   \n",
       "                occupancy_t4013                                 univariate/NAB/occupancy_t4013.test.csv   \n",
       "                rds_cpu_utilization_cc0c53            univariate/NAB/rds_cpu_utilization_cc0c53.test...   \n",
       "                rds_cpu_utilization_e47b3b            univariate/NAB/rds_cpu_utilization_e47b3b.test...   \n",
       "                rogue_agent_key_hold                       univariate/NAB/rogue_agent_key_hold.test.csv   \n",
       "                rogue_agent_key_updown                   univariate/NAB/rogue_agent_key_updown.test.csv   \n",
       "                speed_6005                                           univariate/NAB/speed_6005.test.csv   \n",
       "                speed_7578                                           univariate/NAB/speed_7578.test.csv   \n",
       "                speed_t4013                                         univariate/NAB/speed_t4013.test.csv   \n",
       "\n",
       "                                                     dataset_type  \\\n",
       "collection_name dataset_name                                        \n",
       "NAB             TravelTime_387                               real   \n",
       "                TravelTime_451                               real   \n",
       "                Twitter_volume_AAPL                          real   \n",
       "                Twitter_volume_AMZN                          real   \n",
       "                Twitter_volume_CRM                           real   \n",
       "                Twitter_volume_CVS                           real   \n",
       "                Twitter_volume_FB                            real   \n",
       "                Twitter_volume_GOOG                          real   \n",
       "                Twitter_volume_IBM                           real   \n",
       "                Twitter_volume_KO                            real   \n",
       "                Twitter_volume_PFE                           real   \n",
       "                Twitter_volume_UPS                           real   \n",
       "                ambient_temperature_system_failure           real   \n",
       "                art_daily_flatmiddle                    synthetic   \n",
       "                art_daily_jumpsdown                     synthetic   \n",
       "                art_daily_jumpsup                       synthetic   \n",
       "                art_daily_no_noise                      synthetic   \n",
       "                art_daily_nojump                        synthetic   \n",
       "                art_daily_perfect_square_wave           synthetic   \n",
       "                art_daily_small_noise                   synthetic   \n",
       "                art_flatline                            synthetic   \n",
       "                art_increase_spike_density              synthetic   \n",
       "                art_load_balancer_spikes                synthetic   \n",
       "                art_noisy                               synthetic   \n",
       "                cpu_utilization_asg_misconfiguration         real   \n",
       "                ec2_cpu_utilization_24ae8d                   real   \n",
       "                ec2_cpu_utilization_53ea38                   real   \n",
       "                ec2_cpu_utilization_5f5533                   real   \n",
       "                ec2_cpu_utilization_77c1ca                   real   \n",
       "                ec2_cpu_utilization_825cc2                   real   \n",
       "                ec2_cpu_utilization_ac20cd                   real   \n",
       "                ec2_cpu_utilization_c6585a                   real   \n",
       "                ec2_cpu_utilization_fe7f93                   real   \n",
       "                ec2_disk_write_bytes_1ef3de                  real   \n",
       "                ec2_disk_write_bytes_c0d644                  real   \n",
       "                ec2_network_in_257a54                        real   \n",
       "                ec2_network_in_5abac7                        real   \n",
       "                ec2_request_latency_system_failure           real   \n",
       "                elb_request_count_8c0756                     real   \n",
       "                exchange-2_cpc_results                       real   \n",
       "                exchange-2_cpm_results                       real   \n",
       "                exchange-3_cpc_results                       real   \n",
       "                exchange-3_cpm_results                       real   \n",
       "                exchange-4_cpc_results                       real   \n",
       "                exchange-4_cpm_results                       real   \n",
       "                grok_asg_anomaly                             real   \n",
       "                iio_us-east-1_i-a2eb1cd9_NetworkIn           real   \n",
       "                machine_temperature_system_failure           real   \n",
       "                nyc_taxi                                     real   \n",
       "                occupancy_6005                               real   \n",
       "                occupancy_t4013                              real   \n",
       "                rds_cpu_utilization_cc0c53                   real   \n",
       "                rds_cpu_utilization_e47b3b                   real   \n",
       "                rogue_agent_key_hold                         real   \n",
       "                rogue_agent_key_updown                       real   \n",
       "                speed_6005                                   real   \n",
       "                speed_7578                                   real   \n",
       "                speed_t4013                                  real   \n",
       "\n",
       "                                                      datetime_index  \\\n",
       "collection_name dataset_name                                           \n",
       "NAB             TravelTime_387                                  True   \n",
       "                TravelTime_451                                  True   \n",
       "                Twitter_volume_AAPL                             True   \n",
       "                Twitter_volume_AMZN                             True   \n",
       "                Twitter_volume_CRM                              True   \n",
       "                Twitter_volume_CVS                              True   \n",
       "                Twitter_volume_FB                               True   \n",
       "                Twitter_volume_GOOG                             True   \n",
       "                Twitter_volume_IBM                              True   \n",
       "                Twitter_volume_KO                               True   \n",
       "                Twitter_volume_PFE                              True   \n",
       "                Twitter_volume_UPS                              True   \n",
       "                ambient_temperature_system_failure              True   \n",
       "                art_daily_flatmiddle                            True   \n",
       "                art_daily_jumpsdown                             True   \n",
       "                art_daily_jumpsup                               True   \n",
       "                art_daily_no_noise                              True   \n",
       "                art_daily_nojump                                True   \n",
       "                art_daily_perfect_square_wave                   True   \n",
       "                art_daily_small_noise                           True   \n",
       "                art_flatline                                    True   \n",
       "                art_increase_spike_density                      True   \n",
       "                art_load_balancer_spikes                        True   \n",
       "                art_noisy                                       True   \n",
       "                cpu_utilization_asg_misconfiguration            True   \n",
       "                ec2_cpu_utilization_24ae8d                      True   \n",
       "                ec2_cpu_utilization_53ea38                      True   \n",
       "                ec2_cpu_utilization_5f5533                      True   \n",
       "                ec2_cpu_utilization_77c1ca                      True   \n",
       "                ec2_cpu_utilization_825cc2                      True   \n",
       "                ec2_cpu_utilization_ac20cd                      True   \n",
       "                ec2_cpu_utilization_c6585a                      True   \n",
       "                ec2_cpu_utilization_fe7f93                      True   \n",
       "                ec2_disk_write_bytes_1ef3de                     True   \n",
       "                ec2_disk_write_bytes_c0d644                     True   \n",
       "                ec2_network_in_257a54                           True   \n",
       "                ec2_network_in_5abac7                           True   \n",
       "                ec2_request_latency_system_failure              True   \n",
       "                elb_request_count_8c0756                        True   \n",
       "                exchange-2_cpc_results                          True   \n",
       "                exchange-2_cpm_results                          True   \n",
       "                exchange-3_cpc_results                          True   \n",
       "                exchange-3_cpm_results                          True   \n",
       "                exchange-4_cpc_results                          True   \n",
       "                exchange-4_cpm_results                          True   \n",
       "                grok_asg_anomaly                                True   \n",
       "                iio_us-east-1_i-a2eb1cd9_NetworkIn              True   \n",
       "                machine_temperature_system_failure              True   \n",
       "                nyc_taxi                                        True   \n",
       "                occupancy_6005                                  True   \n",
       "                occupancy_t4013                                 True   \n",
       "                rds_cpu_utilization_cc0c53                      True   \n",
       "                rds_cpu_utilization_e47b3b                      True   \n",
       "                rogue_agent_key_hold                            True   \n",
       "                rogue_agent_key_updown                          True   \n",
       "                speed_6005                                      True   \n",
       "                speed_7578                                      True   \n",
       "                speed_t4013                                     True   \n",
       "\n",
       "                                                      split_at    train_type  \\\n",
       "collection_name dataset_name                                                   \n",
       "NAB             TravelTime_387                             NaN  unsupervised   \n",
       "                TravelTime_451                             NaN  unsupervised   \n",
       "                Twitter_volume_AAPL                        NaN  unsupervised   \n",
       "                Twitter_volume_AMZN                        NaN  unsupervised   \n",
       "                Twitter_volume_CRM                         NaN  unsupervised   \n",
       "                Twitter_volume_CVS                         NaN  unsupervised   \n",
       "                Twitter_volume_FB                          NaN  unsupervised   \n",
       "                Twitter_volume_GOOG                        NaN  unsupervised   \n",
       "                Twitter_volume_IBM                         NaN  unsupervised   \n",
       "                Twitter_volume_KO                          NaN  unsupervised   \n",
       "                Twitter_volume_PFE                         NaN  unsupervised   \n",
       "                Twitter_volume_UPS                         NaN  unsupervised   \n",
       "                ambient_temperature_system_failure         NaN  unsupervised   \n",
       "                art_daily_flatmiddle                       NaN  unsupervised   \n",
       "                art_daily_jumpsdown                        NaN  unsupervised   \n",
       "                art_daily_jumpsup                          NaN  unsupervised   \n",
       "                art_daily_no_noise                         NaN  unsupervised   \n",
       "                art_daily_nojump                           NaN  unsupervised   \n",
       "                art_daily_perfect_square_wave              NaN  unsupervised   \n",
       "                art_daily_small_noise                      NaN  unsupervised   \n",
       "                art_flatline                               NaN  unsupervised   \n",
       "                art_increase_spike_density                 NaN  unsupervised   \n",
       "                art_load_balancer_spikes                   NaN  unsupervised   \n",
       "                art_noisy                                  NaN  unsupervised   \n",
       "                cpu_utilization_asg_misconfiguration       NaN  unsupervised   \n",
       "                ec2_cpu_utilization_24ae8d                 NaN  unsupervised   \n",
       "                ec2_cpu_utilization_53ea38                 NaN  unsupervised   \n",
       "                ec2_cpu_utilization_5f5533                 NaN  unsupervised   \n",
       "                ec2_cpu_utilization_77c1ca                 NaN  unsupervised   \n",
       "                ec2_cpu_utilization_825cc2                 NaN  unsupervised   \n",
       "                ec2_cpu_utilization_ac20cd                 NaN  unsupervised   \n",
       "                ec2_cpu_utilization_c6585a                 NaN  unsupervised   \n",
       "                ec2_cpu_utilization_fe7f93                 NaN  unsupervised   \n",
       "                ec2_disk_write_bytes_1ef3de                NaN  unsupervised   \n",
       "                ec2_disk_write_bytes_c0d644                NaN  unsupervised   \n",
       "                ec2_network_in_257a54                      NaN  unsupervised   \n",
       "                ec2_network_in_5abac7                      NaN  unsupervised   \n",
       "                ec2_request_latency_system_failure         NaN  unsupervised   \n",
       "                elb_request_count_8c0756                   NaN  unsupervised   \n",
       "                exchange-2_cpc_results                     NaN  unsupervised   \n",
       "                exchange-2_cpm_results                     NaN  unsupervised   \n",
       "                exchange-3_cpc_results                     NaN  unsupervised   \n",
       "                exchange-3_cpm_results                     NaN  unsupervised   \n",
       "                exchange-4_cpc_results                     NaN  unsupervised   \n",
       "                exchange-4_cpm_results                     NaN  unsupervised   \n",
       "                grok_asg_anomaly                           NaN  unsupervised   \n",
       "                iio_us-east-1_i-a2eb1cd9_NetworkIn         NaN  unsupervised   \n",
       "                machine_temperature_system_failure         NaN  unsupervised   \n",
       "                nyc_taxi                                   NaN  unsupervised   \n",
       "                occupancy_6005                             NaN  unsupervised   \n",
       "                occupancy_t4013                            NaN  unsupervised   \n",
       "                rds_cpu_utilization_cc0c53                 NaN  unsupervised   \n",
       "                rds_cpu_utilization_e47b3b                 NaN  unsupervised   \n",
       "                rogue_agent_key_hold                       NaN  unsupervised   \n",
       "                rogue_agent_key_updown                     NaN  unsupervised   \n",
       "                speed_6005                                 NaN  unsupervised   \n",
       "                speed_7578                                 NaN  unsupervised   \n",
       "                speed_t4013                                NaN  unsupervised   \n",
       "\n",
       "                                                      train_is_normal  \\\n",
       "collection_name dataset_name                                            \n",
       "NAB             TravelTime_387                                  False   \n",
       "                TravelTime_451                                  False   \n",
       "                Twitter_volume_AAPL                             False   \n",
       "                Twitter_volume_AMZN                             False   \n",
       "                Twitter_volume_CRM                              False   \n",
       "                Twitter_volume_CVS                              False   \n",
       "                Twitter_volume_FB                               False   \n",
       "                Twitter_volume_GOOG                             False   \n",
       "                Twitter_volume_IBM                              False   \n",
       "                Twitter_volume_KO                               False   \n",
       "                Twitter_volume_PFE                              False   \n",
       "                Twitter_volume_UPS                              False   \n",
       "                ambient_temperature_system_failure              False   \n",
       "                art_daily_flatmiddle                            False   \n",
       "                art_daily_jumpsdown                             False   \n",
       "                art_daily_jumpsup                               False   \n",
       "                art_daily_no_noise                              False   \n",
       "                art_daily_nojump                                False   \n",
       "                art_daily_perfect_square_wave                   False   \n",
       "                art_daily_small_noise                           False   \n",
       "                art_flatline                                    False   \n",
       "                art_increase_spike_density                      False   \n",
       "                art_load_balancer_spikes                        False   \n",
       "                art_noisy                                       False   \n",
       "                cpu_utilization_asg_misconfiguration            False   \n",
       "                ec2_cpu_utilization_24ae8d                      False   \n",
       "                ec2_cpu_utilization_53ea38                      False   \n",
       "                ec2_cpu_utilization_5f5533                      False   \n",
       "                ec2_cpu_utilization_77c1ca                      False   \n",
       "                ec2_cpu_utilization_825cc2                      False   \n",
       "                ec2_cpu_utilization_ac20cd                      False   \n",
       "                ec2_cpu_utilization_c6585a                      False   \n",
       "                ec2_cpu_utilization_fe7f93                      False   \n",
       "                ec2_disk_write_bytes_1ef3de                     False   \n",
       "                ec2_disk_write_bytes_c0d644                     False   \n",
       "                ec2_network_in_257a54                           False   \n",
       "                ec2_network_in_5abac7                           False   \n",
       "                ec2_request_latency_system_failure              False   \n",
       "                elb_request_count_8c0756                        False   \n",
       "                exchange-2_cpc_results                          False   \n",
       "                exchange-2_cpm_results                          False   \n",
       "                exchange-3_cpc_results                          False   \n",
       "                exchange-3_cpm_results                          False   \n",
       "                exchange-4_cpc_results                          False   \n",
       "                exchange-4_cpm_results                          False   \n",
       "                grok_asg_anomaly                                False   \n",
       "                iio_us-east-1_i-a2eb1cd9_NetworkIn              False   \n",
       "                machine_temperature_system_failure              False   \n",
       "                nyc_taxi                                        False   \n",
       "                occupancy_6005                                  False   \n",
       "                occupancy_t4013                                 False   \n",
       "                rds_cpu_utilization_cc0c53                      False   \n",
       "                rds_cpu_utilization_e47b3b                      False   \n",
       "                rogue_agent_key_hold                            False   \n",
       "                rogue_agent_key_updown                          False   \n",
       "                speed_6005                                      False   \n",
       "                speed_7578                                      False   \n",
       "                speed_t4013                                     False   \n",
       "\n",
       "                                                      input_type  length  \n",
       "collection_name dataset_name                                              \n",
       "NAB             TravelTime_387                        univariate    2500  \n",
       "                TravelTime_451                        univariate    2162  \n",
       "                Twitter_volume_AAPL                   univariate   15902  \n",
       "                Twitter_volume_AMZN                   univariate   15831  \n",
       "                Twitter_volume_CRM                    univariate   15902  \n",
       "                Twitter_volume_CVS                    univariate   15853  \n",
       "                Twitter_volume_FB                     univariate   15833  \n",
       "                Twitter_volume_GOOG                   univariate   15842  \n",
       "                Twitter_volume_IBM                    univariate   15893  \n",
       "                Twitter_volume_KO                     univariate   15851  \n",
       "                Twitter_volume_PFE                    univariate   15858  \n",
       "                Twitter_volume_UPS                    univariate   15866  \n",
       "                ambient_temperature_system_failure    univariate    7267  \n",
       "                art_daily_flatmiddle                  univariate    4032  \n",
       "                art_daily_jumpsdown                   univariate    4032  \n",
       "                art_daily_jumpsup                     univariate    4032  \n",
       "                art_daily_no_noise                    univariate    4032  \n",
       "                art_daily_nojump                      univariate    4032  \n",
       "                art_daily_perfect_square_wave         univariate    4032  \n",
       "                art_daily_small_noise                 univariate    4032  \n",
       "                art_flatline                          univariate    4032  \n",
       "                art_increase_spike_density            univariate    4032  \n",
       "                art_load_balancer_spikes              univariate    4032  \n",
       "                art_noisy                             univariate    4032  \n",
       "                cpu_utilization_asg_misconfiguration  univariate   18050  \n",
       "                ec2_cpu_utilization_24ae8d            univariate    4032  \n",
       "                ec2_cpu_utilization_53ea38            univariate    4032  \n",
       "                ec2_cpu_utilization_5f5533            univariate    4032  \n",
       "                ec2_cpu_utilization_77c1ca            univariate    4032  \n",
       "                ec2_cpu_utilization_825cc2            univariate    4032  \n",
       "                ec2_cpu_utilization_ac20cd            univariate    4032  \n",
       "                ec2_cpu_utilization_c6585a            univariate    4032  \n",
       "                ec2_cpu_utilization_fe7f93            univariate    4032  \n",
       "                ec2_disk_write_bytes_1ef3de           univariate    4730  \n",
       "                ec2_disk_write_bytes_c0d644           univariate    4032  \n",
       "                ec2_network_in_257a54                 univariate    4032  \n",
       "                ec2_network_in_5abac7                 univariate    4730  \n",
       "                ec2_request_latency_system_failure    univariate    4032  \n",
       "                elb_request_count_8c0756              univariate    4032  \n",
       "                exchange-2_cpc_results                univariate    1624  \n",
       "                exchange-2_cpm_results                univariate    1624  \n",
       "                exchange-3_cpc_results                univariate    1538  \n",
       "                exchange-3_cpm_results                univariate    1538  \n",
       "                exchange-4_cpc_results                univariate    1643  \n",
       "                exchange-4_cpm_results                univariate    1643  \n",
       "                grok_asg_anomaly                      univariate    4621  \n",
       "                iio_us-east-1_i-a2eb1cd9_NetworkIn    univariate    1243  \n",
       "                machine_temperature_system_failure    univariate   22695  \n",
       "                nyc_taxi                              univariate   10320  \n",
       "                occupancy_6005                        univariate    2380  \n",
       "                occupancy_t4013                       univariate    2500  \n",
       "                rds_cpu_utilization_cc0c53            univariate    4032  \n",
       "                rds_cpu_utilization_e47b3b            univariate    4032  \n",
       "                rogue_agent_key_hold                  univariate    1882  \n",
       "                rogue_agent_key_updown                univariate    5315  \n",
       "                speed_6005                            univariate    2500  \n",
       "                speed_7578                            univariate    1127  \n",
       "                speed_t4013                           univariate    2495  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dm.refresh()\n",
    "dm.df().loc[(slice(dataset_collection_name,dataset_collection_name), slice(None))]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Experimentation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "dataset = \"realAdExchange/exchange-4_cpc_results.csv\"\n",
    "source_file = os.path.join(source_folder, \"data\", dataset)\n",
    "df = pd.read_csv(source_file)\n",
    "df[\"timestamp\"] = pd.to_datetime(df['timestamp'], infer_datetime_format=True)\n",
    "df[\"is_anomaly\"] = 0\n",
    "\n",
    "for t1, t2 in windows[dataset]:\n",
    "    t1 = datetime.strptime(t1, \"%Y-%m-%d %H:%M:%S.%f\")\n",
    "    t2 = datetime.strptime(t2, \"%Y-%m-%d %H:%M:%S.%f\")\n",
    "    moreThanT1 = df[df[\"timestamp\"] >= t1]\n",
    "    betweenT1AndT2 = moreThanT1[moreThanT1[\"timestamp\"] <= t2]\n",
    "    indices = betweenT1AndT2.index\n",
    "    df[\"is_anomaly\"].values[indices.values] = 1\n",
    "\n",
    "df[df[\"is_anomaly\"] == 1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(\"data-raw/Community-NAB/labels/combined_labels.json\", 'r') as f:\n",
    "    labels = json.load(f)\n",
    "labels"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(\"data-raw/Community-NAB/labels/combined_windows.json\", 'r') as f:\n",
    "    windows = json.load(f)\n",
    "windows"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def to_datetime(str):\n",
    "    try:\n",
    "        return datetime.strptime(str, \"%Y-%m-%d %H:%M:%S\")\n",
    "    except ValueError:\n",
    "        return datetime.strptime(str, \"%Y-%m-%d %H:%M:%S.%f\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "matches = 0\n",
    "for dataset in windows:\n",
    "    for (anomaly, anomaly_window) in zip(labels[dataset], windows[dataset]):\n",
    "        maybe_middle = to_datetime(anomaly)\n",
    "        (start, end) = [to_datetime(d) for d in anomaly_window]\n",
    "        diff1 = maybe_middle - start\n",
    "        diff2 = end - maybe_middle\n",
    "        if diff1 == diff2:\n",
    "            # print(f\"{dataset}-{anomaly} is in the middle of anomaly window!\")\n",
    "            matches += 1\n",
    "        else:\n",
    "            print(dataset)\n",
    "            print(f\"{start} - ({diff1})- {anomaly} -({diff2})- {end}\")\n",
    "print(f\"matches: {matches}/{sum(list(map(lambda x: len(labels[x]), labels)))}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "timeeval",
   "language": "python",
   "name": "timeeval"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
